package io;

import java.io.*;

/**
 * @author liyang
 * @version 1.0
 * @package io
 * @file Copy3.java
 * @description
 * @time 2024-03-22 17:31
 */
public class CopyDemo3 {
    public static void main(String[] args) throws IOException {

        FileOutputStream fos = new FileOutputStream("./image_cp.png");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        FileInputStream fis = new FileInputStream("./image.png");
        BufferedInputStream bis = new BufferedInputStream(fis);
        long start = System.currentTimeMillis();

        int d;
        while ((d = bis.read()) != -1){
            bos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕,耗时"+(end-start)+"毫秒");
        bos.close();
        bis.close();
    }
}
